home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 033a / prokit34.zip / MDOSIO.INT < prev    next >
Text File  |  1991-04-01  |  4KB  |  129 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. (*
  14.  * mdosio - library for interface to DOS v3 file access functions (3-1-89)
  15.  *
  16.  *)
  17.  
  18. unit MDosIO;
  19.  
  20. interface
  21.  
  22.    uses Dos,debugs;
  23.  
  24.    type
  25.       dos_filename = string[64];
  26.       dos_handle   = word;
  27.  
  28.       long_integer = record
  29.          lsw: word;
  30.          msw: word;
  31.       end;
  32.  
  33.       seek_modes = (seek_start {0},
  34.                     seek_cur   {1},
  35.                     seek_end   {2});
  36.  
  37.       open_modes = (open_read  {h40},     {deny_nothing, allow_read}
  38.                     open_write {h41},     {deny_nothing, allow_write}
  39.                     open_update{h42});    {deny_nothing, allow_read+write}
  40.  
  41.       dos_time_functions = (time_get,
  42.                             time_set);
  43.  
  44.    const
  45.       dos_error   = $FFFF; {file handle after an error}
  46.       min_handle  = 2;
  47.       max_handle  = 10;
  48.       dos_retry_count:  integer = 0;
  49.  
  50.    var
  51.       dos_regs:         registers;
  52.       dos_name:         dos_filename;
  53.       dos_write_err:    boolean;
  54.       dos_names:        array[min_handle..max_handle] of dos_filename;
  55.  
  56.    type
  57.       dos_functions = (_open,  _creat,
  58.                        _close, _times,
  59.                        _read,  _write,
  60.                        _rseek, _lseek,
  61.                        _lock,  _unlock);
  62.  
  63.    const
  64.       function_names:  array[dos_functions] of string[5] =
  65.                       ('OPEN', 'CREAT',
  66.                        'CLOSE','TIMES',
  67.                        'READ', 'WRITE',
  68.                        'RSEEK','LSEEK',
  69.                        'LOCK', 'UNLCK');
  70.                        
  71.  
  72.    procedure dos_check_error(fun: dos_functions);
  73.  
  74.    procedure dos_call(fun: dos_functions);
  75.  
  76.    function dos_open(name:      dos_filename;
  77.                      mode:      open_modes):  dos_handle;
  78.  
  79.    function dos_create(name:    dos_filename): dos_handle;
  80.  
  81.    function dos_read( handle:   dos_handle;
  82.                       var       buffer;
  83.                       bytes:    word): word;
  84.  
  85.    procedure dos_write(handle:  dos_handle;
  86.                        var      buffer;
  87.                        bytes:   word);
  88.  
  89.    procedure dos_lseek(handle:  dos_handle;
  90.                        offset:  longint;
  91.                        method:  seek_modes);
  92.  
  93.    procedure dos_rseek(handle:  dos_handle;
  94.                        recnum:  word;
  95.                        recsiz:  word;
  96.                        method:  seek_modes);
  97.  
  98.    function dos_tell: longint;
  99.  
  100.    procedure dos_find_eof(fd:   dos_handle);
  101.  
  102.    procedure dos_close(handle:  dos_handle);
  103.  
  104.    procedure dos_unlink(name:   dos_filename);
  105.  
  106.    procedure dos_file_times(fd:       dos_handle;
  107.                             func:     dos_time_functions;
  108.                             var time: word;
  109.                             var date: word);
  110.  
  111.    function dos_jdate(time,date: word): longint;
  112.  
  113.    function dos_exists(name: dos_filename): boolean;
  114.  
  115.    function dos_lock(handle:  dos_handle;
  116.                      offset:  longint;
  117.                      bytes:   word): boolean;
  118.  
  119.    procedure dos_unlock(handle:  dos_handle;
  120.                         offset:  longint;
  121.                         bytes:   word);
  122.  
  123.    procedure dos_time(var ms: longint);
  124.  
  125.    procedure dos_delay(ms: longint);
  126.  
  127.  
  128. implementation
  129.